 /* Write a program to convert hexadecimal numbers to binary numbers (directly). */
using System.IO;
using System;
using System.Collections.Generic;

class HexToBinary
{
    static void Main()
    {
        //FormatExeption .. it is not a hex number
        //Console.WriteLine("Please enter hex number");
        //string hexNumber = Console.ReadLine();
        string hexNumber = "FF";
        string binaryNumber = "";
        List<int> result = new List<int>();
        for (int i = 0; i < hexNumber.Length; i++)
        {
            int num = 0;
            if (hexNumber[i] == 'A')
            {
                num = int.Parse("10");
            }
            else if (hexNumber[i] == 'B')
            {
                num = int.Parse("11");
            }
            else if (hexNumber[i] == 'C')
            {
                num = int.Parse("12");
            }
            else if (hexNumber[i] == 'D')
            {
                num = int.Parse("13");
            }
            else if (hexNumber[i] == 'E')
            {
                num = int.Parse("14");
            }
            else if (hexNumber[i] == 'F')
            {
                num = 15;
            }
            else
            {
                num = int.Parse(hexNumber[i].ToString());
            }
            
            
            for (int j = 0; j < 4; j++)
            {
                
                //bitCounter++;
                int bit = 1 & num;
                result.Add(bit);
                num = num >> 1;
            }
            
            for(int k = result.Count - 1; k >= 0; k--)
            {
                Console.Write(result[k]);
            }
            
            result.Clear();

            /*
            foreach (var item in result)
            {
                binaryNumber += item.ToString();
            }
            */
        }

        Console.WriteLine(binaryNumber);
    }
}

